﻿/******************************************************************************
* File description: DBExeSetting.qml
* Function: 打靶实验配置页面
* Current Version: 1.1
* Author: 陈乃瑞
* Date: 2025-07-01
*  -----
*  Copyright by 博坤生物 .
 *****************************************************************************/
import QtQuick 2.0
import QtQuick.Window 2.12
import QtQuick.Layouts 1.1
import QtQuick.Controls.Styles 1.2
import QtQuick.Controls 2.12
import QtMultimedia 5.14

//import "../animation"

Rectangle {
    width: parent.width
    height: parent.height
    radius: 12
    property int listnum: 0
    property int onid: 1  // 当前选中实验（实验名称点击）
    property int onnum: 1  // 当前选中步骤数
    property int onisdef: 1  // 当前选中是否默认
    property bool xzfl: false //当前选中是否展开
    property int bzonnum: -1 //当前步骤开始执行实验
    property var sylist: CExeConfig.dbreadsypzlist("")
    signal refr();
    signal fmref();
    //    minimumHeight: 860*dp
    //    minimumWidth: 1430*dp
    //    maximumHeight: 860*dp
    //    maximumWidth: 1430*dp
    property var coorX: []      // 当前按钮坐标（每次拖动实时刷新）
    property var coorY: []
    property var originX: [10*dp, 180*dp, 350*dp, 520*dp, 690*dp, 10*dp, 180*dp, 10*dp, 180*dp, 350*dp]
    property var originY: [45*dp, 45*dp, 45*dp, 45*dp, 45*dp, 90*dp, 90*dp, 135*dp, 135*dp, 135*dp]
    property var onDrag: [false, false, false, false, false, false, false, false, false, false]  // 7个
    property real dragX: 0      // 拖动的坐标
    property real dragY: 0
    property real biasX: 0      // 临时坐标，记录鼠标和按钮的偏移量
    property real biasY: 0
    property int num: 10
    property int enterindex: -1  // 进入实验流程索引
    property var dragStartX: 0  // 临时记录 点击开始的坐标
    property var dragStartY: 0
    property bool isPressed: false  // 临时记录 鼠标是否处于按下状态
    property bool isupda: false
    property var fmlist: ["0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0"]
    property string fmlistinfo: ""
    property int tabfl: 0
    Connections{
        target: CSignal
        onSendSyringRunMsg:{
            if(status==="0"){
                if(serial==="7"){
                    toast.show("转盘执行完成",0)
                }
                else if(serial!="8")
                {
                    toast.show(serial+"号注射器执行完成",0)
                    zsqfw.enabled=true
                }
            }
            else if(status==="1"){
                if(serial==="7"){
                    toast.show("转盘正在执行中,请耐心等待",1)
                }
                else if(serial!="8")
                {
                    toast.show(serial+"号注射器正在执行中,请耐心等待",1)
                }
            }
        }
        onSendResetMsg:{
            if(status==="0"){
                toast.show("复位完成",0)
//                zsqtz.enabled=true
                zsqzx.enabled=true
            }
            else if(status==="1"){
                toast.show("正在进行复位,请耐心等待",2)
            }
        }
        onSyringDataLack:{
            toast.show("注射器参数数据缺失,请补充完整",1)
        }
    }
    Connections{
        onFmref:{
            var kfmnub = 0;
            for (var i = 0; i < fmlist.length; i++) {
                if (fmlist[i] === "1") {
                    kfmnub++;
                }
            }
            // 计算阀门关的数量
            var closedValves = 15 - kfmnub;
            // 更新 fminfo 的文本内容
            fminfo.text = "阀门开数量: " + kfmnub + "             阀门关数量: " + closedValves;
        }
    }

    property int issavenum: -1
    property int issaveid: -1
    CustomPopupBoxWarning{
        id: savepop
        box_text: "是否保存对实验修改！"
        onAccepted: {
            if(issavenum===1){
                CExeConfig.dbupall(onid,issaveid,xbdz.getText(),"","","",
                                   "","","","","")
            }else if(issavenum===2){
                CExeConfig.dbupall(onid,issaveid,lqdz.getText(),lqhq.getText(),"","",
                                   "","","","","")
            }else if(issavenum===3){
                CExeConfig.dbupall(onid,issaveid,gzdz.getText(),"","","",
                                   "","","","","")
            }else if(issavenum===4){
                CExeConfig.dbupall(onid,issaveid,ybdz.getText(),"","","","","","","","")
            }else if(issavenum===5){
                CExeConfig.dbupall(onid,issaveid,sddz.getText(),"","","","","","","","")
            }else if(issavenum===6){
                CExeConfig.dbupall(onid,issaveid,jldz.getText(),"","","","","","","","")
            }else if(issavenum===7){
                CExeConfig.dbupall(onid,issaveid,cbdz.getText(),"","","","","","","","")
            }else if(issavenum===8){
                CExeConfig.dbupall(onid,issaveid,ddsj.getText(),"","","",
                                   "","","","","")
            }else if(issavenum===9){
                CExeConfig.dbupall(onid,issaveid,ztdz.getText(),ztqr.getText(),"","",
                                   "","","","","")
            }
            toast.show("保存成功", 0)
            issave=0
        }
        onRejected: {
            issave=0
        }
    }
    onVisibleChanged: {
        //        zsqls.model=CExeConfig.getzsqdef()
        //        zpgls.model=CExeConfig.getggdef()
        isupda=false
        sylist= CExeConfig.dbreadsypzlist("")
        gjpz.bzlist=CExeConfig.dbgetlclist(onid)
        gjpz.onbz=CExeConfig.dbrsyxx(onid)[1]-1
        if(gjpz.onbz===-1){
            dbgjpz.button_color="white"
            dbgjpz.button_border="black"
            dbgjpz.icon_color="green"
            dbgjpz.text_color="black"
        }else{
            dbgjpz.button_color="green"
            dbgjpz.button_border="green"
            dbgjpz.icon_color="white"
            dbgjpz.text_color="white"
        }
        ldsylx.model=CGetMessageInterface.getConsumableList()
//        ldsymc.model=CGetMessageInterface.getSingleMethodList(4,ldsylx.getText())
        //        sytype.model=CExeConfig.gethclxdef()
        updateCoor()
    }
    Timer{      // 救不了了，我也不知道为啥这个坐标计算总不触发
        running: parent.visible
        interval: 800
        repeat: true
        onTriggered: {
            updateCoor()
        }
    }

    function updateCoor(){
        coorX = []
        coorY = []
        for(let i = 0; i < num; i ++){
            if(onDrag[i]){
                coorX.push(dragX - biasX)
                coorY.push(dragY - biasY)
            }else{
                coorX.push(originX[i])
                coorY.push(originY[i])
            }
        }
        for(let i = 0; i < num; i ++){
            buttonList.children[i].x = coorX[i]
            buttonList.children[i].y = coorY[i]

            if(onDrag[i]){
                buttonList.children[i].z = 1
            }else{
                buttonList.children[i].z = 0
            }
        }
        coorXChanged()
        coorYChanged()
    }

    Component.onCompleted: {
        updateCoor()
    }

    CustomPopupBoxWarning{
        id: deflc
        showRejectedButton: false
        box_text: qsTr("默认流程不可删除！")
    }
    CustomPopupBoxWarning{
        id: defaildb
        showRejectedButton: false
        box_text: qsTr("关联项目不可删除！")
    }
    CustomPopupBoxWarning{
        id: chnoe
        showRejectedButton: false
        box_text: qsTr("添加失败,无纯化实验!")
    }
    Connections{
        target: CExeConfig
        onDelfaildb:{
            defaildb.show()
        }
    }

    // 模拟数据
    ListModel {
        id: myModel
        ListElement { label: "1"; index: 0 }
        ListElement { label: "2"; index: 1 }
        ListElement { label: "3"; index: 2 }
        ListElement { label: "4"; index: 3 }
        ListElement { label: "5"; index: 4 }
        ListElement { label: "6"; index: 5 }
        ListElement { label: "7"; index: 6 }
        ListElement { label: "8"; index: 7 }
        ListElement { label: "9"; index: 8 }
        ListElement { label: "10"; index: 9 }
        ListElement { label: "11"; index: 10 }
        ListElement { label: "12"; index: 11 }
        ListElement { label: "13"; index: 12 }
        ListElement { label: "14"; index: 13 }
    }
    color: "white"
    //    title: "实验配置"
    GJPZpop{
        id:gjpz
    }

    Connections{  // qmlre
        target: CExeConfig
        onAddlist:{
            sylist=CExeConfig.dbreadsypzlist(synamess.getText())
        }
    }
    Connections{  // qmlre
        target: CExeConfig
        onUpdatatab:{
            sylist=CExeConfig.dbreadsypzlist(synamess.getText())
        }
    }
    Connections{  // qmlre
        target: CExeConfig
        onDellist:{
            sylist=CExeConfig.dbreadsypzlist(synamess.getText())
        }
    }
    Connections{  // qmlre
        target: CExeConfig
        onUplist:{
            sylist=CExeConfig.dbreadsypzlist(synamess.getText())
        }
    }
    Connections{  // qmlre
        target: CExeConfig
        onSave:{
            toast.show("保存成功",0)
        }
        onChnoexp:{
            chnoe.show()
        }
    }
    Connections{
        target: CExeConfig
        onRename:{
            toast2.show("实验名称不允许重复",1)
        }
    }

    Toast{
        id: toast
        y: 200*dp
        x: parent.width / 2 - 150*dp
        z: 1
    }
    Toast{
        id: toast2
        y: 200*dp
        x: parent.width / 2 - 150*dp
        z: 1
    }
    Rectangle{
        x:10*dp
        y:10*dp
        width: parent.width-20*dp
        height: parent.height-20*dp
        color: "white"
        // 按钮区域 ======================================================
        Rectangle{
            z:100
            id: buttonList
            x: 20*dp
            y: 10*dp
            width: parent.width*0.70
            height: 180*dp
            color: "#F7F7FA"
            onHeightChanged: {
                updateCoor()
            }onWidthChanged: {
                updateCoor()
            }

            IPushButton{
                width: 150*dp
                height: 32*dp
                button_icon: "qrc:/picture/pz_xb2.png"
                button_icons: "qrc:/picture/pz_tz.png"
                icon_width: 24*dp
                icon_height: 24*dp
                button_color: isHover?"#003B72":"#00417E"
                icon_color: "white"
                text_color: "white"
                title: qsTr("吸取梭体")
                onPressed: {
                    isPressed = true
                    var mousePos = mapToItem(buttonList, mouseX, mouseY)
                    dragStartX = mousePos.x
                    dragStartY = mousePos.y
                    var biasPos = mapToItem(this, mouseX, mouseY)
                    biasX = biasPos.x
                    biasY = biasPos.y
                    updateCoor()
                }
                onPositionChanged: {
                    if(!isPressed) return
                    var mousePos = mapToItem(buttonList, mouseX, mouseY)
                    dragX = mousePos.x
                    dragY = mousePos.y
                    if(dragStartX!=dragX || dragStartY!=dragY){     // 检测到位移，触发拖动
                        onDrag[0] = true
                    }
                    updateCoor()

                }
                onReleased: {
                    isPressed = false

                    var mousePos = mapToItem(dbsypzmod.itemAt(onid-1), mouseX, mouseY)
                    if(onDrag[0]){
                        onDrag[0] = false
                        console.log("目标现坐标x",mousePos.x,"目标现坐标y",mousePos.y,onid-1)
                        if(onid-1>=0&&mousePos.x>0&&mousePos.x<250&&mousePos.y>33){
                            console.log(xzfl)
                            if(xzfl){
                                CExeConfig.dbaddkjchange(onid,mousePos.y,1);
                            }
                        }
                        //                                    console.log(mouseY)
                    }else{
                        //                        console.log("触发点击事件"+index)
                    }
                    updateCoor()
                }
            }
            IPushButton{
                width: 150*dp
                height: 32*dp
                button_icon: "qrc:/picture/pz_lq2.png"
                button_icons: "qrc:/picture/pz_tz.png"
                icon_width: 24*dp
                icon_height: 24*dp
                button_color: isHover?"#44806C":"#5BA58C"
                icon_color: "white"
                text_color: "white"
                title: qsTr("冷却")
                onPressed: {
                    isPressed = true
                    var mousePos = mapToItem(buttonList, mouseX, mouseY)
                    dragStartX = mousePos.x
                    dragStartY = mousePos.y
                    var biasPos = mapToItem(this, mouseX, mouseY)
                    biasX = biasPos.x
                    biasY = biasPos.y
                    updateCoor()
                }
                onPositionChanged: {
                    if(!isPressed) return
                    var mousePos = mapToItem(buttonList, mouseX, mouseY)
                    dragX = mousePos.x
                    dragY = mousePos.y
                    if(dragStartX!=dragX || dragStartY!=dragY){     // 检测到位移，触发拖动
                        onDrag[1] = true
                    }
                    updateCoor()

                }
                onReleased: {
                    isPressed = false

                    var mousePos = mapToItem(dbsypzmod.itemAt(onid-1), mouseX, mouseY)
                    if(onDrag[1]){
                        onDrag[1] = false
                        console.log("目标现坐标x",mousePos.x,"目标现坐标y",mousePos.y)
                        if(onid-1>=0&&mousePos.x>0&&mousePos.x<250&&mousePos.y>33){
                            if(xzfl){
                                CExeConfig.dbaddkjchange(onid,mousePos.y,2);
                            }
                        }
                        //                                    console.log(mouseY)
                    }else{
                        //                        console.log("触发点击事件"+index)
                    }
                    updateCoor()
                }
            }
            IPushButton{
                width: 150*dp
                height: 32*dp
                button_icon: "qrc:/picture/pz_gz2.png"
                button_icons: "qrc:/picture/pz_tz.png"
                icon_width: 24*dp
                icon_height: 24*dp
                button_color: isHover?"#9A2020":"#BF5353"
                icon_color: "white"
                text_color: "white"
                title: qsTr("干燥")
                onPressed: {
                    isPressed = true
                    var mousePos = mapToItem(buttonList, mouseX, mouseY)
                    dragStartX = mousePos.x
                    dragStartY = mousePos.y
                    var biasPos = mapToItem(this, mouseX, mouseY)
                    biasX = biasPos.x
                    biasY = biasPos.y
                    updateCoor()
                }
                onPositionChanged: {
                    if(!isPressed) return
                    var mousePos = mapToItem(buttonList, mouseX, mouseY)
                    dragX = mousePos.x
                    dragY = mousePos.y
                    if(dragStartX!=dragX || dragStartY!=dragY){     // 检测到位移，触发拖动
                        onDrag[2] = true
                    }
                    updateCoor()
                }
                onReleased: {
                    isPressed = false

                    var mousePos = mapToItem(dbsypzmod.itemAt(onid-1), mouseX, mouseY)
                    if(onDrag[2]){
                        onDrag[2] = false
                        console.log("目标现坐标",mousePos.y)
                        if(onid-1>=0&&mousePos.x>0&&mousePos.x<250&&mousePos.y>33){
                            if(xzfl){
                                CExeConfig.dbaddkjchange(onid,mousePos.y,3);
                            }
                        }
                        //                                    console.log(mouseY)
                    }else{
                        //                        console.log("触发点击事件"+index)
                    }
                    updateCoor()
                }
            }
            IPushButton{
                width: 150*dp
                height: 32*dp
                button_icon: "qrc:/picture/pz_yb2.png"
                button_icons: "qrc:/picture/pz_tz.png"
                icon_width: 24*dp
                icon_height: 24*dp
                button_color: isHover?"#58448A":"#705BA5"
                icon_color: "white"
                text_color: "white"
                title: qsTr("梭体组合运行")
                onPressed: {
                    isPressed = true
                    var mousePos = mapToItem(buttonList, mouseX, mouseY)
                    dragStartX = mousePos.x
                    dragStartY = mousePos.y
                    var biasPos = mapToItem(this, mouseX, mouseY)
                    biasX = biasPos.x
                    biasY = biasPos.y
                    updateCoor()
                }
                onPositionChanged: {
                    if(!isPressed) return
                    var mousePos = mapToItem(buttonList, mouseX, mouseY)
                    dragX = mousePos.x
                    dragY = mousePos.y
                    if(dragStartX!=dragX || dragStartY!=dragY){     // 检测到位移，触发拖动
                        onDrag[3] = true
                    }
                    updateCoor()

                }
                onReleased: {
                    isPressed = false

                    var mousePos = mapToItem(dbsypzmod.itemAt(onid-1), mouseX, mouseY)
                    if(onDrag[3]){
                        onDrag[3] = false
                        console.log("目标现坐标",mousePos.y)
                        if(onid-1>=0&&mousePos.x>0&&mousePos.x<250&&mousePos.y>33){
                            if(xzfl){
                                CExeConfig.dbaddkjchange(onid,mousePos.y,4);
                            }
                        }
                        //                                    console.log(mouseY)
                    }else{
                        //                        console.log("触发点击事件"+index)
                    }
                    updateCoor()
                }
            }
            IPushButton{
                width: 150*dp
                height: 32*dp
                button_icon: "qrc:/picture/pz_sd2.png"
                button_icons: "qrc:/picture/pz_tz.png"
                icon_width: 24*dp
                icon_height: 24*dp
                button_color: isHover?"#755B27":"#9B7E47"
                icon_color: "white"
                text_color: "white"
                title: qsTr("抱闸")
                onPressed: {
                    isPressed = true
                    var mousePos = mapToItem(buttonList, mouseX, mouseY)
                    dragStartX = mousePos.x
                    dragStartY = mousePos.y
                    var biasPos = mapToItem(this, mouseX, mouseY)
                    biasX = biasPos.x
                    biasY = biasPos.y
                    updateCoor()
                }
                onPositionChanged: {
                    if(!isPressed) return
                    var mousePos = mapToItem(buttonList, mouseX, mouseY)
                    dragX = mousePos.x
                    dragY = mousePos.y
                    if(dragStartX!=dragX || dragStartY!=dragY){     // 检测到位移，触发拖动
                        onDrag[4] = true
                    }
                    updateCoor()

                }
                onReleased: {
                    isPressed = false

                    var mousePos = mapToItem(dbsypzmod.itemAt(onid-1), mouseX, mouseY)
                    if(onDrag[4]){
                        onDrag[4] = false
                        console.log("目标现坐标",mousePos.y)
                        if(onid-1>=0&&mousePos.x>0&&mousePos.x<250&&mousePos.y>33){
                            if(xzfl){
                                CExeConfig.dbaddkjchange(onid,mousePos.y,5);
                            }
                        }
                        //                                    console.log(mouseY)
                    }else{
                        //                        console.log("触发点击事件"+index)
                    }
                    updateCoor()
                }
            }
            IPushButton{
                width: 150*dp
                height: 32*dp
                button_icon: "qrc:/picture/pz_jl2.png"
                button_icons: "qrc:/picture/pz_tz.png"
                icon_width: 24*dp
                icon_height: 24*dp
                button_color: isHover?"#343E77":"#5B66A4"
                icon_color: "white"
                text_color: "white"
                title: qsTr("梭体上靶")
                onPressed: {
                    isPressed = true
                    var mousePos = mapToItem(buttonList, mouseX, mouseY)
                    dragStartX = mousePos.x
                    dragStartY = mousePos.y
                    var biasPos = mapToItem(this, mouseX, mouseY)
                    biasX = biasPos.x
                    biasY = biasPos.y
                    updateCoor()
                }
                onPositionChanged: {
                    if(!isPressed) return
                    var mousePos = mapToItem(buttonList, mouseX, mouseY)
                    dragX = mousePos.x
                    dragY = mousePos.y
                    if(dragStartX!=dragX || dragStartY!=dragY){     // 检测到位移，触发拖动
                        onDrag[5] = true
                    }
                    updateCoor()

                }
                onReleased: {
                    isPressed = false

                    var mousePos = mapToItem(dbsypzmod.itemAt(onid-1), mouseX, mouseY)
                    if(onDrag[5]){
                        onDrag[5] = false
                        console.log("目标现坐标",mousePos.y)
                        if(onid-1>=0&&mousePos.x>0&&mousePos.x<250&&mousePos.y>33){
                            if(xzfl){
                                CExeConfig.dbaddkjchange(onid,mousePos.y,6);
                            }
                        }
                        //                                    console.log(mouseY)
                    }else{
                        //                        console.log("触发点击事件"+index)
                    }
                    updateCoor()
                }
            }
            IPushButton{
                width: 150*dp
                height: 32*dp
                button_icon: "qrc:/picture/pz_cb2.png"
                button_icons: "qrc:/picture/pz_tz.png"
                icon_width: 24*dp
                icon_height: 24*dp
                button_color: isHover?"#6D247F":"#89439B"
                icon_color: "white"
                text_color: "white"
                title: qsTr("加速端回靶")
                onPressed: {
                    isPressed = true
                    var mousePos = mapToItem(buttonList, mouseX, mouseY)
                    dragStartX = mousePos.x
                    dragStartY = mousePos.y
                    var biasPos = mapToItem(this, mouseX, mouseY)
                    biasX = biasPos.x
                    biasY = biasPos.y
                    updateCoor()
                }
                onPositionChanged: {
                    if(!isPressed) return
                    var mousePos = mapToItem(buttonList, mouseX, mouseY)
                    dragX = mousePos.x
                    dragY = mousePos.y
                    if(dragStartX!=dragX || dragStartY!=dragY){     // 检测到位移，触发拖动
                        onDrag[6] = true
                    }
                    updateCoor()

                }
                onReleased: {
                    isPressed = false

                    var mousePos = mapToItem(dbsypzmod.itemAt(onid-1), mouseX, mouseY)
                    if(onDrag[6]){
                        onDrag[6] = false
                        console.log("目标现坐标",mousePos.y)
                        if(onid-1>=0&&mousePos.x>0&&mousePos.x<250&&mousePos.y>33){
                            if(xzfl){
                                CExeConfig.dbaddkjchange(onid,mousePos.y,7);
                            }
                        }
                        //                                    console.log(mouseY)
                    }else{
                        //                        console.log("触发点击事件"+index)
                    }
                    updateCoor()
                }
            }
            IPushButton{
                width: 150*dp
                height: 32*dp
                button_icon: "qrc:/picture/pz_dd.png"
                button_icons: "qrc:/picture/pz_tz.png"
                icon_width: 24*dp
                icon_height: 24*dp
                button_color: isHover?"#C75D92":"#FFB1D8"
                text_color: "white"
                title: qsTr("等待")
                onPressed: {
                    isPressed = true
                    var mousePos = mapToItem(buttonList, mouseX, mouseY)
                    dragStartX = mousePos.x
                    dragStartY = mousePos.y
                    var biasPos = mapToItem(this, mouseX, mouseY)
                    biasX = biasPos.x
                    biasY = biasPos.y
                    updateCoor()
                }
                onPositionChanged: {
                    if(!isPressed) return
                    var mousePos = mapToItem(buttonList, mouseX, mouseY)
                    dragX = mousePos.x
                    dragY = mousePos.y
                    if(dragStartX!=dragX || dragStartY!=dragY){     // 检测到位移，触发拖动
                        onDrag[7] = true
                    }
                    updateCoor()

                }
                onReleased: {
                    isPressed = false

                    var mousePos = mapToItem(dbsypzmod.itemAt(onid-1), mouseX, mouseY)
                    if(onDrag[7]){
                        onDrag[7] = false
                        console.log("目标现坐标",mousePos.y)
                        if(onid-1>=0&&mousePos.x>0&&mousePos.x<250&&mousePos.y>33){
                            if(xzfl){
                                CExeConfig.dbaddkjchange(onid,mousePos.y,8);
                            }
                        }
                        //                                    console.log(mouseY)
                    }else{
                        //                        console.log("触发点击事件"+index)
                    }
                    updateCoor()
                }
            }
            IPushButton{
                width: 150*dp
                height: 32*dp
                button_icon: "qrc:/picture/pz_zt.png"
                button_icons: "qrc:/picture/pz_tz.png"
                icon_width: 24*dp
                icon_height: 24*dp
                button_color: isHover?"#406FBC":"#89B5FF"
                text_color: "white"
                title: qsTr("暂停")
                onPressed: {
                    isPressed = true
                    var mousePos = mapToItem(buttonList, mouseX, mouseY)
                    dragStartX = mousePos.x
                    dragStartY = mousePos.y
                    var biasPos = mapToItem(this, mouseX, mouseY)
                    biasX = biasPos.x
                    biasY = biasPos.y
                    updateCoor()
                }
                onPositionChanged: {
                    if(!isPressed) return
                    var mousePos = mapToItem(buttonList, mouseX, mouseY)
                    dragX = mousePos.x
                    dragY = mousePos.y
                    if(dragStartX!=dragX || dragStartY!=dragY){     // 检测到位移，触发拖动
                        onDrag[8] = true
                    }
                    updateCoor()

                }
                onReleased: {
                    isPressed = false

                    var mousePos = mapToItem(dbsypzmod.itemAt(onid-1), mouseX, mouseY)
                    if(onDrag[8]){
                        onDrag[8] = false
                        console.log("目标现坐标",mousePos.y)
                        if(onid-1>=0&&mousePos.x>0&&mousePos.x<250&&mousePos.y>33){
                            if(xzfl){
                                CExeConfig.dbaddkjchange(onid,mousePos.y,9);
                            }
                        }
                        //                                    console.log(mouseY)
                    }else{
                        //                        console.log("触发点击事件"+index)
                    }
                    updateCoor()
                }
            }
            IPushButton{
                id:ldbt
                visible: pbflag!==1
                width: 150*dp
                height: 32*dp
                button_icon: "qrc:/picture/pz_ld.png"
                button_icons: "qrc:/picture/pz_tz.png"
                icon_width: 24*dp
                icon_height: 24*dp
                button_color: isHover?"#3CAFA3":"#7EE3D8"
                text_color: "white"
                title: qsTr("联动")
                button_color_disable:enabled?button_color:"#DEDEDE"
                onPressed: {
                    isPressed = true
                    var mousePos = mapToItem(buttonList, mouseX, mouseY)
                    dragStartX = mousePos.x
                    dragStartY = mousePos.y
                    var biasPos = mapToItem(this, mouseX, mouseY)
                    biasX = biasPos.x
                    biasY = biasPos.y
                    updateCoor()
                }
                onPositionChanged: {
                    if(!isPressed) return
                    var mousePos = mapToItem(buttonList, mouseX, mouseY)
                    dragX = mousePos.x
                    dragY = mousePos.y
                    if(dragStartX!=dragX || dragStartY!=dragY){     // 检测到位移，触发拖动
                        onDrag[9] = true
                    }
                    updateCoor()

                }
                onReleased: {
                    isPressed = false

                    var mousePos = mapToItem(dbsypzmod.itemAt(onid-1), mouseX, mouseY)
                    if(onDrag[9]){
                        onDrag[9] = false
                        console.log("目标现坐标",mousePos.y)
                        if(onid-1>=0&&mousePos.x>0&&mousePos.x<250&&mousePos.y>33){
                            if(xzfl){
                                CExeConfig.dbaddkjchange(onid,mousePos.y,10);
                            }
                        }
                        //                                    console.log(mouseY)
                    }else{
                        //                        console.log("触发点击事件"+index)
                    }
                    updateCoor()
                }
            }
            Rectangle{
                x: 10*dp
                y: 10*dp
                height: 30*dp
                width: parent.width-10*dp
                color: "#F7F7FA"
                Text {
                    text: qsTr("拖拽以下元素到下方菜单中编辑实验流程")
                    font.pixelSize: config.fontsize
                    color: "#999999"
                }
            }
        }
        // 示意图区域 ========================================================
        Rectangle{
            z:0
            width: parent.width*0.25
            height: buttonList.height
            x: parent.width*0.73
            y: 10*dp
            border.color: "#B8B7B5"
            color: "#E0E6E9"
            radius: 8
            Image {
                id: pic1
                source: "qrc:/picture/gldb.png"
                fillMode: Image.PreserveAspectFit
                width: parent.width
                height: parent.height
            }
            Text {
                id: sytname
                text: qsTr("")
                font.pixelSize: config.fontsize
                horizontalAlignment: Qt.AlignRight
                font.weight: Font.Bold
                width: 60*dp
                height: 30*dp
                x:parent.width-70*dp
                y:10*dp
            }
        }
        // 下面的区域 =========================================================
        Rectangle{
            z:0
            x:20*dp
            y:buttonList.height+50*dp
            width: parent.width-40*dp
            height: parent.height-buttonList.height-70*dp
            radius: 12
            border.color: "#B8B7B5"
            clip: true
            PushButton{
                x:20*dp
                y:10*dp
                button_icon: "qrc:/picture/pz_xj.png"
                title: qsTr("新建")
                width: 60*dp
                height: 38*dp
                text_color: "#1677FF"
                button_color: isHover?"#ededed":"transparent"
                icon_height: 20*dp
                icon_width: 20*dp
                onReleased: {
                    CExeConfig.dbnewsypz()
                }
            }
            CustomButton{
                x:85*dp
                y:10*dp
                button_icon: "qrc:/picture/pz_dr.png"
                title: qsTr("导入")
                width: 60*dp
                height: 38*dp
                text_color: "#1677FF"
                text_color_hover: "#1677FF"
                text_color_press: "#1677FF"
                button_color: isHovered?"#ededed":"transparent"
                icon_size: 20*dp
                CustomTooltip{
                    visible: parent.isHovered
                    text: qsTr("点击导入实验")
                }
                onReleased: {
                    var data= CExeConfig.importExeConfig(2)
                    if(data===0){
                        toast.show("导入成功",0)
                    }
                    else if(data===-1){
                        toast.show("文件不存在",1)
                    }
                    else if(data===-2){
                        toast.show("导入文件数据格式不正确",1)
                    }
                    sylist=CExeConfig.dbreadsypzlist(synamess.getText())
                }
            }
            CustomButton{
                x:150*dp
                y:10*dp
                button_icon: "qrc:/picture/pz_dc.png"
                title: qsTr("导出")
                width: 60*dp
                height: 38*dp
                text_color: "#1677FF"
                text_color_hover: "#1677FF"
                text_color_press: "#1677FF"
                button_color: isHovered?"#ededed":"transparent"
                icon_size: 20*dp
                CustomTooltip{
                    visible: parent.isHovered
                    text: qsTr("选中实验点击导出")
                }
                onReleased: {
                    var data= CExeConfig.exportExeConfig(2,onid.toString())
                    if(data===0){
                        toast.show("导出成功",0)
                    }
                    else if(data===-1){
                        toast.show("文件不存在",1)
                    }
                    else if(data===-2){
                        toast.show("导出失败",1)
                    }
                    else if(data===-3){
                        toast.show("当前选中的实验不存在,导出失败",1)
                    }
                }
            }
            CustomInputText{
                id:synamess
                y:50*dp
                x:10*dp
                editHeight: 30*dp
                editWidth:260*dp
                prompt: qsTr("实验名称搜索")
                clearAllButton: true
                textLeftPadding: 36*dp
                inputMaxLength: 15
                onTextChanged: {
                    sylist=CExeConfig.dbreadsypzlist(synamess.getText())
                    myColumnLayout.forceLayout()
                }
                Image {
                    x:5*dp; y: 5*dp
                    width: 20*dp
                    height: 20*dp
                    z:100
                    source: "qrc:/picture/pz_ss.png"
                }
                //                CustomButton {
                //                    x:parent.width-25*dp
                //                    width: 20*dp
                //                    height: 20*dp
                //                    z:100
                //                    anchors.verticalCenter: parent.verticalCenter
                //                    button_icon: isHovered?"qrc:/picture/pz_qc2.png":"qrc:/picture/pz_qc.png"
                //                    onReleased: {
                //                        synamess.setText("")
                //                    }
                //                }
            }


            Rectangle{
                id:sypzxx
                x:10*dp
                y:100*dp
                width: 260*dp
                height: parent.height-110*dp
                ScrollView {
                    x:0*dp
                    y:0*dp
                    width: 260*dp
                    height: parent.height-40*dp
                    ScrollBar.horizontal.policy: ScrollBar.AlwaysOff
                    clip: true
                    Column{
                        id:myColumnLayout
                        width: 260*dp
                        height: parent.height
                        spacing: 10*dp
                        Repeater{
                            id:dbsypzmod
                            model: sylist
                            delegate: Item {
                                x:3*dp
                                width: parent.width
                                height: kjmod.height
                                DBSYPZModel {
                                    id:kjmod
                                     z:1000
                                    syid: modelData.syid
                                    titlev: modelData.syname
                                    onEntersy: {
                                        enterindex=sylcnum-1
                                        onisdef = btfl3
                                    }
                                    onDelonnub: {
//                                        if(btfl3===1){
//                                            deflc.show()
//                                        }else{
                                            CExeConfig.dbdelsypz(syid)
//                                        }
                                    }
                                    onCopyonnub: {
                                        CExeConfig.dbcopyypz(syid)
                                    }

                                    onClickcccc: {
                                        xzfl = iszk
                                        onid = syid
                                        console.log(xzfl,onid)
                                        onisdef = btfl3
                                        if(!(titleval==="实验信息"||titleval==="芯片孔位")){
                                            onnum = Number(numval)
                                        }else{
                                            onnum=0
                                        }
                                        var alda = CExeConfig.dbreadall(onid,onnum)
                                        if(titleval==="实验信息"||titleval==="芯片孔位"){
                                            tabfl=0
                                            syname.setText(alda[0])
                                            gjpz.bzlist=CExeConfig.dbgetlclist(onid)
                                            gjpz.onbz=alda[1]-1
                                            if(gjpz.onbz===-1){
                                                dbgjpz.button_color="white"
                                                dbgjpz.button_border="black"
                                                dbgjpz.icon_color="green"
                                                dbgjpz.text_color="black"
                                            }else{
                                                dbgjpz.button_color="green"
                                                dbgjpz.button_border="green"
                                                dbgjpz.icon_color="white"
                                                dbgjpz.text_color="white"
                                            }
                                            pic1.source="qrc:/picture/gldb.png"
                                        }else if(titleval==="吸取梭体"){
                                            tabfl=1
                                            xbdz.setText(alda[0])
                                            pic1.source="qrc:/picture/gldb_xb.png"
                                            sytname.text=qsTr("吸取梭体")
                                        }else if(titleval==="冷却"){
                                            tabfl=2
                                            lqdz.setText(alda[0])
                                            lqhq.setText(alda[1])
                                            pic1.source="qrc:/picture/gldb_lq.png"
                                            sytname.text=qsTr("冷却")
                                        }else if(titleval==="干燥"){
                                            tabfl=3
                                            gzdz.setText(alda[0])
                                            pic1.source="qrc:/picture/gldb_gz.png"
                                            sytname.text=qsTr("干燥")
                                        }else if(titleval==="梭体组合运行"){
                                            tabfl=4
                                            ybdz.setText(alda[0])
                                            pic1.source="qrc:/picture/gldb_yb.png"
                                            sytname.text=qsTr("梭体组合运行")
                                        }else if(titleval==="抱闸"){
                                            tabfl=5
                                            sddz.setText(alda[0])
                                            pic1.source="qrc:/picture/gldb_sd.png"
                                            sytname.text=qsTr("抱闸")
                                        }else if(titleval==="梭体上靶"){
                                            tabfl=6
                                            jldz.setText(alda[0])
                                            pic1.source="qrc:/picture/gldb_jl.png"
                                            sytname.text=qsTr("梭体上靶")
                                        }else if(titleval==="加速端回靶"){
                                            tabfl=7
                                            cbdz.setText(alda[0])
                                            pic1.source="qrc:/picture/gldb_cb.png"
                                            sytname.text=qsTr("加速端回靶")
                                        }else if(titleval==="等待"){
                                            tabfl=8
                                            dddz.checkedIndex=alda[0]
                                            ddsj.setText(alda[1])
                                            ddbz.setText(alda[2])
                                            pic1.source="qrc:/picture/gldb.png"
                                            sytname.text=qsTr("等待")
                                        }else if(titleval==="暂停"){
                                            tabfl=9
                                            ztdz.setText(alda[0])
                                            ztqr.setText(alda[1])
                                            pic1.source="qrc:/picture/gldb.png"
                                            sytname.text=qsTr("暂停")
                                        }else if(titleval==="联动"){
                                            tabfl=10
                                            ldmk.setText(alda[0])
                                            ldsylx.setText(alda[1])
                                            ldsymc.setText(alda[2])
                                            ldbf.setText(alda[3])
                                            pic1.source="qrc:/picture/glfb.png"
                                            sytname.text=qsTr("联动")
                                        }
                                    }
                                }
                            }
                        }
                    }
                }
            }

            Rectangle{
                x:280*dp
                y:0*dp
                width: 1*dp
                height: parent.height
                color: "#B8B7B5"
                z:10
            }

            Rectangle{
                id:dbsyxx
                visible: tabfl===0
                x:285*dp
                y:10*dp
                width: parent.width-295*dp
                height: parent.height-20*dp
                Rectangle{
                    x:20*dp
                    y:10*dp
                    Text {
                        id:xyxxbt
                        text: qsTr("实验信息")
                        font.bold: true
                        font.pixelSize: config.fontsize + 3*dp
                    }
                }
                CustomButton{
                    id:dbgjpz
                    x:parent.width-250*dp
                    y:20*dp
                    width: 100*dp
                    height: 36*dp
                    title: qsTr("高级配置")
                    button_color: "white"
                    button_border: "black"
                    icon_color: "green"
                    text_color: "black"
                    onReleased: {
                        gjpz.show()
                    }
                }
                CustomButton{
                    x:parent.width-120*dp
                    y:20*dp
                    width: 100*dp
                    height: 36*dp
                    title: qsTr("保存")
                    defaultMode1: true
                    onReleased: {
                        CExeConfig.dbwsyxx(onid,syname.getText(),bzonnum)
                        toast.show(qsTr("保存成功"), 0)
                        gjpz.onbz=CExeConfig.dbrsyxx(onid)[1]-1
                        if(gjpz.onbz===-1){
                            dbgjpz.button_color="white"
                            dbgjpz.button_border="black"
                            dbgjpz.icon_color="green"
                            dbgjpz.text_color="black"
                        }else{
                            dbgjpz.button_color="green"
                            dbgjpz.button_border="green"
                            dbgjpz.icon_color="white"
                            dbgjpz.text_color="white"
                        }
                    }
                }
                CustomInputText{
                    id:syname
                    x:parent.width/4-180*dp
                    y:100*dp
                    title: qsTr("实验名称")
                    required: true
                    height: 40*dp
                    editWidth: 260*dp
                    titleWidth: 100*dp
                    defaultText: CExeConfig.dbrsyxx(onid)[0]
                    inputMaxLength: 20
                }
            }
            Rectangle{
                id:xbtab
                visible: tabfl===1
                x:285*dp
                y:10*dp
                width: parent.width-295*dp
                height: parent.height-20*dp
                onVisibleChanged: {
                    if(!visible){
                        issavenum=1
                        if(issave===1){
                            savepop.box_text=qsTr("是否保存对【吸取梭体】修改！")
                            savepop.show()
                        }
                    }
                }
                Rectangle{
                    x:20*dp
                    y:10*dp
                    Row{
                        Text {
                            id:ttype
                            text: qsTr("吸取梭体")
                            font.bold: true
                            font.pixelSize: config.fontsize + 3*dp
                        }
                        CustomButton{
                            y:4*dp
                            width: 20*dp
                            height: 20*dp
                            icon_size: 15*dp
                            button_icon: isHovered?"qrc:/picture/pz_wh2.png":"qrc:/picture/pz_wh.png"
                            CustomTooltip{
                                visible: parent.isHovered
                                colorflag: 2
                                text: qsTr("吸取靶材罐")
                            }
                        }
                    }
                }
                CustomButton{
                    id:xbzx
                    x:parent.width-240*dp
                    y:20*dp
                    width: 100*dp
                    height: 36*dp
                    title: qsTr("执行")
                    defaultMode2: true
                    radius: 4
                    onReleased: {
                        gStateOp.openPopup("22",[])
                        CommunicationMethod.stepOperatingSimulation(2,1,[xbdz.getText()])
                    }
                }
                PushButton{
                    x:parent.width-120*dp
                    y:20*dp
                    width: 100*dp
                    height: 36*dp
                    title: qsTr("保存")
                    defaultMode1: true
                    onReleased: {
                        CExeConfig.dbupall(onid,onnum,xbdz.getText(),"","","",
                                           "","","","","")
                        toast.show(qsTr("保存成功"), 0)
                        issave=0
                    }
                }
                CustomComboBox{
                    id:xbdz
                    x:parent.width/4-180*dp
                    y:100*dp
                    title: qsTr("动作")
                    width: 360*dp
                    height: 40*dp
                    editWidth: 260*dp
                    titleWidth: 100*dp
                    model: [qsTr("开启"),qsTr("关闭")]
                    onClickText: {
                        issave=1
                        issaveid=onnum
                    }
                }
            }
            Rectangle{
                id:lqtab
                visible: tabfl===2
                x:285*dp
                y:10*dp
                width: parent.width-295*dp
                height: parent.height-20*dp
                onVisibleChanged: {
                    if(!visible){
                        issavenum=2
                        if(issave===1){
                            savepop.box_text=qsTr("是否保存对【冷却】修改！")
                            savepop.show()
                        }
                    }
                }
                Rectangle{
                    x:20*dp
                    y:10*dp
                    Row{
                        Text {
                            text: qsTr("冷却")
                            font.bold: true
                            font.pixelSize: config.fontsize + 3*dp
                        }
                        CustomButton{
                            y:4*dp
                            width: 20*dp
                            height: 20*dp
                            icon_size: 15*dp
                            button_icon: isHovered?"qrc:/picture/pz_wh2.png":"qrc:/picture/pz_wh.png"
                            CustomTooltip{
                                visible: parent.isHovered
                                colorflag: 2
                                text: qsTr("打靶中，将靶材片降温，并充氦气")
                            }
                        }
                    }
                }
                PushButton{
                    x:parent.width-240*dp
                    y:20*dp
                    width: 100*dp
                    height: 36*dp
                    title: qsTr("执行")
                    defaultMode2: true
                    radius: 4
                    onReleased: {
                        gStateOp.openPopup("23",[lqdz.getText()])
                        CommunicationMethod.stepOperatingSimulation(2,2,[lqdz.getText(),lqhq.getText()])
                    }
                }
                PushButton{
                    x:parent.width-120*dp
                    y:20*dp
                    width: 100*dp
                    height: 36*dp
                    title: qsTr("保存")
                    defaultMode1: true
                    onReleased: {
                        CExeConfig.dbupall(onid,onnum,lqdz.getText(),lqhq.getText(),"","",
                                           "","","","","")
                        toast.show("保存成功", 0)
                        issave=0
                    }
                }
                CustomComboBox{
                    id:lqdz
                    x:parent.width/4-180*dp
                    y:100*dp
                    title: qsTr("动作")
                    model: [qsTr("开"),qsTr("关")]
                    width: 360*dp
                    height: 40*dp
                    editWidth: 260*dp
                    titleWidth: 100*dp
                    onClickText: {
                        issave=1
                        issaveid=onnum
                    }
                }
                CustomComboBox{
                    id:lqhq
                    x:parent.width/4*3-180*dp
                    y:100*dp
                    title: qsTr("氦气开关")
                    width: 360*dp
                    height: 40*dp
                    editWidth: 260*dp
                    titleWidth: 100*dp
                    model: [qsTr("开启"),qsTr("关闭")]
                    onClickText: {
                        issave=1
                        issaveid=onnum
                    }
                }

            }
            Rectangle{
                id:gztab
                visible: tabfl===3
                x:285*dp
                y:10*dp
                width: parent.width-295*dp
                height: parent.height-20*dp
                onVisibleChanged: {
                    if(!visible){
                        issavenum=3
                        if(issave===1){
                            savepop.box_text=qsTr("是否保存对【干燥】修改！")
                            savepop.show()
                        }
                    }
                }
                Rectangle{
                    x:20*dp
                    y:10*dp
                    Row{
                        Text {
                            text: qsTr("干燥")
                            font.bold: true
                            font.pixelSize: config.fontsize + 3*dp
                        }
                        CustomButton{
                            y:4*dp
                            width: 20*dp
                            height: 20*dp
                            icon_size: 15*dp
                            button_icon: isHovered?"qrc:/picture/pz_wh2.png":"qrc:/picture/pz_wh.png"
                            CustomTooltip{
                                visible: parent.isHovered
                                colorflag: 2
                                text: qsTr("打靶后，靶材片吹气干燥")
                            }
                        }
                    }
                }
                PushButton{
                    x:parent.width-240*dp
                    y:20*dp
                    width: 100*dp
                    height: 36*dp
                    title: qsTr("执行")
                    defaultMode2: true
                    radius: 4
                    onReleased: {
                        gStateOp.openPopup("24",[gzdz.getText()])
                        CommunicationMethod.stepOperatingSimulation(2,3,[gzdz.getText()])
                    }
                }
                PushButton{
                    x:parent.width-120*dp
                    y:20*dp
                    width: 100*dp
                    height: 36*dp
                    title: qsTr("保存")
                    defaultMode1: true
                    onReleased: {
                        CExeConfig.dbupall(onid,onnum,gzdz.getText(),"","","",
                                           "","","","","")
                        toast.show("保存成功", 0)
                        issave=0
                    }
                }
                CustomInputText{
                    id:gzdz
                    x:parent.width/4-180*dp
                    y:100*dp
                    title: qsTr("时间(min)")
                    width: 360*dp
                    height: 40*dp
                    editWidth: 260*dp
                    titleWidth: 100*dp
                    onTextEditChanged: {
                        issave=1
                        issaveid=onnum
                    }
                }
            }
            Rectangle{
                id:ybtab
                visible: tabfl===4
                x:285*dp
                y:10*dp
                width: parent.width-295*dp
                height: parent.height-20*dp
                onVisibleChanged: {
                    if(!visible){
                        issavenum=4
                        if(issave===1){
                            savepop.box_text=qsTr("是否保存对【移靶】修改！")
                            savepop.show()
                        }
                    }
                }
                Rectangle{
                    x:20*dp
                    y:10*dp
                    Row{
                        Text {
                            text: qsTr("移靶")
                            font.bold: true
                            font.pixelSize: config.fontsize + 3*dp
                        }
                        CustomButton{
                            y:4*dp
                            width: 20*dp
                            height: 20*dp
                            icon_size: 15*dp
                            button_icon: isHovered?"qrc:/picture/pz_wh2.png":"qrc:/picture/pz_wh.png"
                            CustomTooltip{
                                visible: parent.isHovered
                                colorflag: 2
                                text: qsTr("靶材罐在接靶位置与打靶位置间移动")
                            }
                        }
                    }
                }
                PushButton{
                    x:parent.width-240*dp
                    y:20*dp
                    width: 100*dp
                    height: 36*dp
                    title: qsTr("执行")
                    defaultMode2: true
                    radius: 4
                    onReleased: {
                        gStateOp.openPopup("25",[])
                        CommunicationMethod.stepOperatingSimulation(2,4,[ybdz.getText()])
                    }
                }
                PushButton{
                    x:parent.width-120*dp
                    y:20*dp
                    width: 100*dp
                    height: 36*dp
                    title: qsTr("保存")
                    defaultMode1: true
                    onReleased: {
                        CExeConfig.dbupall(onid,onnum,ybdz.getText(),"","","","","","","","")
                        toast.show(qsTr("保存成功"), 0)
                        issave=0
                    }
                }
                CustomComboBox{
                    id:ybdz
                    x:parent.width/4-180*dp
                    y:100*dp
                    title: qsTr("动作")
                    model: [qsTr("进靶"),qsTr("退靶")]
                    width: 360*dp
                    height: 40*dp
                    editWidth: 260*dp
                    titleWidth: 100*dp
                    onClickText: {
                        issave=1
                        issaveid=onnum
                    }
                }
            }
            Rectangle{
                id:sdtab
                visible: tabfl===5
                x:285*dp
                y:10*dp
                width: parent.width-295*dp
                height: parent.height-20*dp
                onVisibleChanged: {
                    if(!visible){
                        issavenum=5
                        if(issave===1){
                            savepop.box_text=qsTr("是否保存对【抱闸】修改！")
                            savepop.show()
                        }
                    }
                }
                Rectangle{
                    x:20*dp
                    y:10*dp
                    Row{
                        Text {
                            text: qsTr("抱闸")
                            font.bold: true
                            font.pixelSize: config.fontsize + 3*dp
                        }
                        CustomButton{
                            y:4*dp
                            width: 20*dp
                            height: 20*dp
                            icon_size: 15*dp
                            button_icon: isHovered?"qrc:/picture/pz_wh2.png":"qrc:/picture/pz_wh.png"
                            CustomTooltip{
                                visible: parent.isHovered
                                colorflag: 2
                                text: qsTr("接靶和送靶后开启抱闸，固定【移靶】防止松动。初始状态为抱闸。")
                            }
                        }
                    }
                }
                PushButton{
                    x:parent.width-240*dp
                    y:20*dp
                    width: 100*dp
                    height: 36*dp
                    title: qsTr("执行")
                    defaultMode2: true
                    radius: 4
                    onReleased: {
                        gStateOp.openPopup("26",[])
                        CommunicationMethod.stepOperatingSimulation(2,5,[sddz.getText()])
                    }
                }
                PushButton{
                    x:parent.width-120*dp
                    y:20*dp
                    width: 100*dp
                    height: 36*dp
                    title: qsTr("保存")
                    defaultMode1: true
                    onReleased: {
                        CExeConfig.dbupall(onid,onnum,sddz.getText(),"","","","","","","","")
                        toast.show(qsTr("保存成功"), 0)
                        issave=0
                    }
                }
                CustomComboBox{
                    id:sddz
                    x:parent.width/4-180*dp
                    y:100*dp
                    title: qsTr("动作")
                    model: [qsTr("锁止"),qsTr("松开")]
                    width: 360*dp
                    height: 40*dp
                    editWidth: 260*dp
                    titleWidth: 100*dp
                    onClickText: {
                        issave=1
                        issaveid=onnum
                    }
                }
            }
            Rectangle{
                id:jltab
                visible: tabfl===6
                x:285*dp
                y:10*dp
                width: parent.width-295*dp
                height: parent.height-20*dp
                onVisibleChanged: {
                    if(!visible){
                        issavenum=6
                        if(issave===1){
                            savepop.box_text=qsTr("是否保存对【梭体上靶】修改！")
                            savepop.show()
                        }
                    }
                }
                Rectangle{
                    x:20*dp
                    y:10*dp
                    Row{
                        Text {
                            text: qsTr("梭体上靶")
                            font.bold: true
                            font.pixelSize: config.fontsize + 3*dp
                        }
                        CustomButton{
                            y:4*dp
                            width: 20*dp
                            height: 20*dp
                            icon_size: 15*dp
                            button_icon: isHovered?"qrc:/picture/pz_wh2.png":"qrc:/picture/pz_wh.png"
                            CustomTooltip{
                                visible: parent.isHovered
                                colorflag: 2
                                text: qsTr("对接【吸取梭体】，送或接靶材罐")
                            }
                        }
                    }
                }
                PushButton{
                    x:parent.width-240*dp
                    y:20*dp
                    width: 100*dp
                    height: 36*dp
                    title: qsTr("执行")
                    defaultMode2: true
                    radius: 4
                    onReleased: {
                        gStateOp.openPopup("27",[])
                        CommunicationMethod.stepOperatingSimulation(2,6,[jldz.getText()])
                    }
                }
                PushButton{
                    x:parent.width-120*dp
                    y:20*dp
                    width: 100*dp
                    height: 36*dp
                    title: qsTr("保存")
                    defaultMode1: true
                    onReleased: {
                        CExeConfig.dbupall(onid,onnum,jldz.getText(),"","","","","","","","")
                        toast.show("保存成功", 0)
                        issave=0
                    }
                }
                CustomComboBox{
                    id:jldz
                    x:parent.width/4-180*dp
                    y:100*dp
                    title: qsTr("动作")
                    model: [qsTr("下移"),qsTr("上移")]
                    width: 360*dp
                    height: 40*dp
                    editWidth: 260*dp
                    titleWidth: 100*dp
                    onClickText: {
                        issave=1
                        issaveid=onnum
                    }
                }
            }
            Rectangle{
                id:cbtab
                visible: tabfl===7
                x:285*dp
                y:10*dp
                width: parent.width-295*dp
                height: parent.height-20*dp
                onVisibleChanged: {
                    if(!visible){
                        issavenum=7
                        if(issave===1){
                            savepop.box_text=qsTr("是否保存对【加速端回靶】修改！")
                            savepop.show()
                        }
                    }
                }
                Rectangle{
                    x:20*dp
                    y:10*dp
                    Row{
                        Text {
                            text: qsTr("加速端回靶")
                            font.bold: true
                            font.pixelSize: config.fontsize + 3*dp
                        }
                        CustomButton{
                            y:4*dp
                            width: 20*dp
                            height: 20*dp
                            icon_size: 15*dp
                            button_icon: isHovered?"qrc:/picture/pz_wh2.png":"qrc:/picture/pz_wh.png"
                            CustomTooltip{
                                visible: parent.isHovered
                                colorflag: 2
                                text: qsTr("靶材罐传送，需预先打开【挡板】，【开盖】位置在靶材灌位置上方，【梭体上靶】在上")
                            }
                        }
                    }
                }
                PushButton{
                    x:parent.width-240*dp
                    y:20*dp
                    width: 100*dp
                    height: 36*dp
                    title: qsTr("执行")
                    defaultMode2: true
                    radius: 4
                    onReleased: {
                        gStateOp.openPopup("28",[])
                        CommunicationMethod.stepOperatingSimulation(2,7,[cbdz.getText()])
                    }
                }
                PushButton{
                    x:parent.width-120*dp
                    y:20*dp
                    width: 100*dp
                    height: 36*dp
                    title: qsTr("保存")
                    defaultMode1: true
                    onReleased: {
                        CExeConfig.dbupall(onid,onnum,cbdz.getText(),"","","","","","","","")
                        toast.show("保存成功", 0)
                        issave=0
                    }
                }
                CustomComboBox{
                    id:cbdz
                    x:parent.width/4-180*dp
                    y:100*dp
                    title: qsTr("动作")
                    model: [qsTr("加速端回靶")]
                    width: 360*dp
                    height: 40*dp
                    editWidth: 260*dp
                    titleWidth: 100*dp
                    onClickText: {
                        issave=1
                        issaveid=onnum
                    }
                }
            }
            Rectangle{
                id:ddtab
                visible: tabfl===8
                x:285*dp
                y:10*dp
                width: parent.width-295*dp
                height: parent.height-20*dp
                onVisibleChanged: {
                    if(!visible){
                        issavenum=8
                        if(issave===1){
                            savepop.box_text=qsTr("是否保存对【等待】修改！")
                            savepop.show()
                        }
                    }
                }
                Rectangle{
                    x:20*dp
                    y:10*dp
                    Row{
                        Text {
                            text: qsTr("等待")
                            font.bold: true
                            font.pixelSize: config.fontsize + 3*dp
                        }
                        CustomButton{
                            y:4*dp
                            width: 20*dp
                            height: 20*dp
                            icon_size: 15*dp
                            button_icon: isHovered?"qrc:/picture/pz_wh2.png":"qrc:/picture/pz_wh.png"
                            CustomTooltip{
                                visible: parent.isHovered
                                colorflag: 2
                                text: qsTr("设置等待时长，任意动作后都可添加")
                            }
                        }
                    }
                }
                CustomPopupBoxWarning{
                    id: ddpop2
                    box_text: "参数未填写，请确认是否保存！"
                    onAccepted: {
                        CExeConfig.dbupall(onid,onnum,dddz.checkedIndex,ddsj.getText(),ddbz.getText(),"",
                                           "","","","","")
                        toast.show("保存成功", 0)
                        issave=0
                    }
                }
                PushButton{
                    x:parent.width-120*dp
                    y:20*dp
                    width: 100*dp
                    height: 36*dp
                    title: "保存"
                    defaultMode1: true
                    onReleased: {
                        if(dddz.checkedIndex===1&&parseInt(ddbz.getText())>=onnum){
                            ddpop.show()
                            return
                        }
                        if(dddz.checkedIndex===0&&ddsj.getText()===""){
                            ddpop2.show()
                            return
                        }else if(dddz.checkedIndex===1&&ddbz.getText()===""){
                            ddpop2.show()
                            return
                        }else{

                        }
                        CExeConfig.dbupall(onid,onnum,dddz.checkedIndex,ddsj.getText(),ddbz.getText(),"",
                                           "","","","","")
                        toast.show("保存成功", 0)
                        issave=0
                    }
                }
                CustomRadioGroup{
                    id:dddz
                    x:parent.width/4-200*dp
                    y:100*dp
                    spacing: parent.width/2-50*dp
                    model: ["",""]
                    checkedIndex:0
                    onCheckedIndexChanged: {
                        if(checkedIndex===0){
                            ddsj.editable=true
                            ddbz.editable=false
                        }else{
                            ddbz.editable=true
                            ddsj.editable=false
                        }
                    }
                }

                CustomInputText{
                    id:ddsj
                    x:parent.width/4-170*dp
                    y:100*dp
                    title: qsTr("时间（s）")
                    width: 360*dp
                    height: 40*dp
                    editWidth: 260*dp
                    titleWidth: 100*dp
                    onTextEditChanged: {
                        issave=1
                        issaveid=onnum
                    }
                }
                CustomInputText{
                    id:ddbz
                    x:parent.width/4*3-170*dp
                    y:100*dp
                    title: qsTr("步骤（步）")
                    editable: false
                    width: 360*dp
                    height: 40*dp
                    editWidth: 260*dp
                    titleWidth: 100*dp
                    onTextEditChanged: {
                        issave=1
                        issaveid=onnum
                    }
                }
            }
            Rectangle{
                id:zttab
                visible: tabfl===9
                x:285*dp
                y:10*dp
                width: parent.width-295*dp
                height: parent.height-20*dp
                onVisibleChanged: {
                    if(!visible){
                        issavenum=9
                        if(issave===1){
                            savepop.box_text=qsTr("是否保存对【暂停】修改！")
                            savepop.show()
                        }
                    }
                }
                Rectangle{
                    x:20*dp
                    y:10*dp
                    Row{
                        Text {
                            text: qsTr("暂停")
                            font.bold: true
                            font.pixelSize: config.fontsize + 3*dp
                        }
                        CustomButton{
                            y:4*dp
                            width: 20*dp
                            height: 20*dp
                            icon_size: 15*dp
                            button_icon: isHovered?"qrc:/picture/pz_wh2.png":"qrc:/picture/pz_wh.png"
                            CustomTooltip{
                                visible: parent.isHovered
                                colorflag: 2
                                text: qsTr("设置暂停，实验暂停后，点击【继续】恢复实验")
                            }
                        }
                    }
                }PushButton{
                    x:parent.width-120*dp
                    y:20*dp
                    width: 100*dp
                    height: 36*dp
                    title: qsTr("保存")
                    defaultMode1: true
                    onReleased: {
                        CExeConfig.dbupall(onid,onnum,ztdz.getText(),ztqr.getText(),"","",
                                           "","","","","")
                        toast.show(qsTr("保存成功"), 0)
                        issave=0
                    }
                }
                CustomComboBox{
                    id:ztdz
                    x:parent.width/4-180*dp
                    y:100*dp
                    title: qsTr("动作")
                    width: 400*dp
                    height: 40*dp
                    editWidth: 260*dp
                    titleWidth: 140*dp
                    model: [qsTr("暂停")]
                    onTextEditableChanged: {
                        issave=1
                        issaveid=onnum
                    }
                }
                CustomComboBox{
                    id:ztqr
                    x:parent.width/4*3-180*dp
                    y:100*dp
                    title: qsTr(qsTr("继续是否需要确认"))
                    width: 400*dp
                    height: 40*dp
                    editWidth: 260*dp
                    titleWidth: 140*dp
                    model: [qsTr("否"),qsTr("是")]
                    onClickText: {
                        issave=1
                        issaveid=onnum
                    }
                }
            }
            Rectangle{
                id:ldtab
                visible: tabfl===10
                x:285*dp
                y:10*dp
                width: parent.width-295*dp
                height: parent.height-20*dp
                onVisibleChanged: {
                    if(!visible){
                        issavenum=10
                        if(issave===1){
                            savepop.box_text=qsTr("是否保存对【联动】修改！")
                            savepop.show()
                        }
                    }
                }
                Rectangle{
                    x:20*dp
                    y:10*dp
                    Row{
                        Text {
                            text: qsTr("联动")
                            font.bold: true
                            font.pixelSize: config.fontsize + 3*dp
                        }
                        CustomButton{
                            y:4*dp
                            width: 20*dp
                            height: 20*dp
                            icon_size: 15*dp
                            button_icon: isHovered?"qrc:/picture/pz_wh2.png":"qrc:/picture/pz_wh.png"
                            CustomTooltip{
                                visible: parent.isHovered
                                colorflag: 2
                                text: qsTr("设置与其他模块优先执行，执行完成后继续执行当前模块的实验流程")
                            }
                        }
                    }
                }
                PushButton{
                    x:parent.width-120*dp
                    y:20*dp
                    width: 100*dp
                    height: 36*dp
                    title: qsTr("保存")
                    defaultMode1: true
                    onReleased: {
                        CExeConfig.dbupall(onid,onnum,ldmk.getText(),ldsylx.getText(),ldsymc.getText(),ldbf.getText(),
                                           "","","","","")
                        toast.show(qsTr("保存成功"), 0)
                        issave=0
                    }
                }
                CustomComboBox{
                    id:ldmk
                    x:parent.width/4-180*dp
                    y:100*dp
                    title: qsTr("模块名称")
                    width: 360*dp
                    height: 40*dp
                    editWidth: 260*dp
                    titleWidth: 100*dp
                    model: [qsTr("纯化")]
                    onClickText: {
                        issave=1
                        issaveid=onnum
                    }
                }

                CustomComboBox{
                    id:ldsylx
                    x:parent.width/4*3-180*dp
                    y:100*dp
                    title: qsTr("耗材名称")
                    width: 360*dp
                    height: 40*dp
                    editWidth: 260*dp
                    titleWidth: 100*dp
                    model: CGetMessageInterface.getConsumableList()
                    onCurrentText: {
                        ldsymc.model=CGetMessageInterface.getSingleMethodList(4,ldsylx.getText())
                        ldsymc.setText("")
                    }
                    onClickText: {
                        issave=1
                        issaveid=onnum
                    }
                }
                CustomComboBox{
                    id:ldsymc
                    x:parent.width/4-180*dp
                    y:160*dp
                    title: qsTr("实验名称")
                    width: 360*dp
                    height: 40*dp
                    editWidth: 260*dp
                    titleWidth: 100*dp
                    model: []
                    onClickText: {
                        issave=1
                        issaveid=onnum
                    }
                }
                CustomComboBox{
                    id:ldbf
                    x:parent.width/4*3-180*dp
                    y:160*dp
                    title: qsTr("是否并发")
                    width: 360*dp
                    height: 40*dp
                    editWidth: 260*dp
                    titleWidth: 100*dp
                    model: ["否","是"]
                    onClickText: {
                        issave=1
                        issaveid=onnum
                    }
                }
            }

        }
    }
}
